<!--
 * @Author: 大辉 dbstt@qq.com
 * @Date: 2023-04-04 11:00:27
 * @LastEditors: 大辉 dbstt@qq.com
 * @LastEditTime: 2023-04-11 13:05:41
 * @FilePath: /blog/iframe1.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div>iframe1</div>
    <div>iframe1</div>
    <div>iframe1</div>
    <div>iframe1</div>

    <script>
      if (window != window.top) {
        // 说明被嵌套
        let host = null;
        let pathname = null;
        try {
          // 多层嵌套window.top[0]下标不存在。会走catch
          host = window.top.location.host;
          pathname = window.top.location.pathname;
        } catch (e) {}
        const parentURL = host + pathname;
        const whitelist = [
          "flightadminapi.17usoft.com/dapserver/",
          "flightadminapi.t.17usoft.com/dapserver/",
          "flightadminapi.17usoft.com/FineReport/ReportServer",
        ];
        // 不在白名单列表内
        if (whitelist.find((i) => i === parentURL) === undefined) {
          document.addEventListener("DOMContentLoaded", function () {
            document.body.innerHTML =
              "如需查看数据请到采云间：http://flightadminapi.17usoft.com/dapserver/#/";
            window.top.location.replace(
              "http://flightadminapi.17usoft.com/dapserver/"
            );
          });
        }
      }
    </script>
  </body>
</html>
